package leaf.cloud.common.massage.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;

/**
 * @ClassName TextMsg
 * @Description
 * @Author YeZiHao
 * @Date 2023/11/13 14:32
 **/
@Getter
@Setter
public class TextMsg extends MassageMain {
    @JSONField(name = "msgtype")
    private final String msgType = "text";
    private Object text;

    public TextMsg() {
    }

    public TextMsg(Object text) {
        this.text = text;
    }

    public TextMsg setTextJson(String text) {
        this.text = new HashMap<String, String>() {{
            put("content", text);
        }};
        return this;
    }
}
